/*
	This file is part of PropExtractor.

	AliceDecrypt is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	AliceDecrypt is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with PropExtractor. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _PEALICESOFTANIMATION_H_
#define _PEALICESOFTANIMATION_H_

#include "PEFile.h"

namespace pe
{

	struct AliceAnimationZippedHeader
	{
		byte header[4];
		dword padding;
		dword size_uncompressed;
		dword size_compressed;
	};

	struct AliceAnimationHeader
	{
		byte header[4];
		dword padding;
		dword data_count;
		dword bones_count;
	};

	struct AliceAnimationData
	{
		PEStream* handle;
		byte* data;
		unsigned int data_total;
		AliceAnimationHeader* header;
	};

	struct AliceAnimationBoneData
	{
		float x, y, z;
		float unknown[8];
	};

	struct AliceAnimationBone
	{
		wchar_t* name;

		dword unknown1;
		dword padding;

		AliceAnimationBoneData* data;
		unsigned int data_count;
	};

	struct AliceAnimation
	{
		AliceAnimationHeader* header;

		AliceAnimationBone* bone;
		unsigned int bone_count;
	};

	PE_EXPORT int AliceZippedAnimationReadHeader(AliceAnimationZippedHeader* a_Target, PEStream* a_Stream);
	PE_EXPORT int AliceZippedAnimationDecompress(AliceAnimationData* a_Target, AliceAnimationZippedHeader* a_Header, PEStream* a_Stream);

	PE_EXPORT int AliceAnimationDecrypt(AliceAnimation* a_Target, AliceAnimationData* a_Data);

	PE_EXPORT int AliceAnimationSaveToFile(AliceAnimationData* a_Data, const char* a_FilePath, const char* a_Pattern = NULL);

}; // namespace pe

#endif